#安装sqlite3:
    
sudo apt-get install sqlite3

#安装git:
    
sudo apt-get install git

#创建git用户:

sudo adduser --system --group --disabled-password --shell /bin/bash --home /home/git --gecos 'Git Version Control Tool' git

#下载Gitea:  
    
sudo wget -O /usr/local/bin/gitea https://dl.gitea.io/gitea/1.21.6/gitea-1.21.6-linux-amd64

#执行权限:   

sudo chmod +x /usr/local/bin/gitea

#创建下列目录并设置其权限和所有者:

sudo mkdir -p /var/lib/gitea/{custom,data,indexers,public,log}\
sudo chown git: /var/lib/gitea/{data,indexers,log}\
sudo chmod 750 /var/lib/gitea/{data,indexers,log}\
sudo mkdir /etc/gitea\
sudo chown root:git /etc/gitea/\
sudo chmod 770 /etc/gitea/

#把gitea添加到service(仓库中gitea.service的内容来自https://docs.gitea.com/zh-cn/installation/linux-service):

sudo cp ./gitea.service /etc/systemd/system/gitea.service

#打开并开机自启gitea服务:
    
sudo systemctl start gitea
sudo systemctl enable gitea

#Gitea默认使用3000端口,如果3000端口没有打开,则通过下面命令打开:
    
sudo ufw allow 3000/tcp